package com.demo.core.exception;

import com.demo.core.enums.ErrorEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;

/**
 * @author Tan-Bowen
 * @description TODO 服务器异常类
 * @date 2021/7/27 16:40
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Slf4j
public class ServerException extends RuntimeException{

    private static final long serialVersionUID = -2277755409378305386L;
    private ErrorEnum errorEnum;
    private String message;

    public ServerException(ErrorEnum errorEnum){
        super(errorEnum.getMsg());
        this.errorEnum = errorEnum;
        this.message=errorEnum.getMsg();
    }

    public ServerException(ErrorEnum errorEnum,String  msg){
        super(msg);
        this.errorEnum = errorEnum;
        this.message = msg;
    }
}
